package demo;

import com.taobao.api.ApiException;
import com.taobao.api.DefaultTaobaoClient;
import com.taobao.api.TaobaoClient;
import com.taobao.api.request.ItemAddRequest;
import com.taobao.api.response.ItemAddResponse;

public class AddItem {

	public static void main(String[] args) {
		
		String appkey = "1021820838";
		String secret = "sandbox2a3b4dbc7f7139ac4d7304bdf";
		final String sessionKey = "6100514c989b9e3202e9af1e58de9777de922c64deeceff3638380614";
		String url = "http://gw.api.tbsandbox.com/router/rest";
		
		TaobaoClient client=new DefaultTaobaoClient(url, appkey, secret);
		ItemAddRequest req=new ItemAddRequest();
		req.setNum(99999L);//数量
		req.setPrice("1000");//价格
		req.setType("fixed");//一口价，非拍卖
		req.setStuffStatus("new");//全新，非二手
		req.setTitle("沙箱测试_hybris服务");
		req.setDesc("最好的hybris");
		req.setLocationState("上海");
		req.setLocationCity("上海");
		req.setCid(50067207L);//电子凭证，商品子类目
		req.setOuterId("5432112345");//外部系统的主键
		try {
			ItemAddResponse response = client.execute(req , sessionKey);
			System.out.println(response.getBody());
		} catch (ApiException e) {
			e.printStackTrace();
		}
	}
}
